<!DOCTYPE HTML>
<html>
<head>
    <meta name="renderer" content="webkit|ie-comp|ie-stand" />
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
    <title>用户登录</title>
<#--<meta name="keywords" content="关键词,5个左右,单个8汉字以内">-->
    <meta name="keywords" content="登录，碧叶之源" />
<#--<meta name="description" content="网站描述，字数尽量空制在80个汉字，160个字符以内！">-->
    <meta name="description" content="碧叶之源登录！" />



    <#--妹子UI-->
    <link type="text/css" rel="stylesheet" href="/plugin/amaze/css/amazeui.min.css" />
    <link type="text/css" rel="stylesheet" href="/plugin/amaze/css/amazeui.datatables.min.css" />
    <link type="text/css" rel="stylesheet" href="/plugin/amaze/css/app.css">
<#--自己的样式-->



</head>

<body data-type="login">


<div class="tpl-login">
    <div class="tpl-login-content">

        <h1 style="color: #E0ECF9;text-align: center">碧叶之源</h1>
        <br/>

        <#--<div class="tpl-login-logo">-->
        <div style="text-align: center">
            <#--<img  src="/img/common/leaf.ico" />-->
            <img style="width: 300px;" src="/img/common/fallen.gif" />
        </div>

        <form class="am-form tpl-form-line-form" method="post" id="userLoginForm">



            <div class="am-form-group">
                <input class="tpl-form-input" type="text" name="logName" id="logName" placeholder="输入登录用户名">
            </div>

            <div class="am-form-group">
                <input class="tpl-form-input" type="password"  id="password" name="password" placeholder="输入登录密码">
            </div>

            <div class="am-form-group">
                <input class="tpl-form-input" type="text" name="verifyCode" id="verifyCode" placeholder="请输入验证码" style="width: 150px;float: left;">
                <img style="margin-left: 10px;" id="codeImage" src="${request.contextPath}/user/getVerifyCode" onclick="replaceCode()" title="图片看不清？点击重新得到验证码"/>
            </div>

            <div class="am-form-group tpl-login-remember-me">
                <input id="rememberMe" name="rememberMe" type="checkbox">
                <label for="remember-me">
                    记住我 <a href="javascript:;">《有效期一个月》</a>
                </label>

            </div>


            <p>
                <button style="width: 120px; float: left;" type="button" class="am-btn am-btn-primary  am-btn-block tpl-btn-bg-color-success  tpl-login-btn" onclick="loginUserFrom()">登录</button>
                <button style="width: 120px; margin-left: 180px;" onclick="javascrtpt:window.location.href='${request.contextPath}/user/regUserUrl'" type="button" class="am-btn am-btn-primary  am-btn-block tpl-btn-bg-color-success  tpl-login-btn" >注册</button>
            </p>

        </form>


    </div>
</div>




    <#--JS 部分 -->
    <script type="text/javascript" src="/js/common/base.js" ></script>
    <script type="text/javascript" src="/js/common/jquery.min.js" ></script>
    <#--妹子UI-->
    <script type="text/javascript" src="/plugin/amaze/js/amazeui.min.js"></script>
    <script type="text/javascript" src="/plugin/amaze/js/app.js"></script>

    <script type="text/javascript" src="/plugin/amaze/js/theme.js"></script>

    <script type="text/javascript">

        /**
         * 用户登录
         */
        function loginUserFrom() {

            var logName = $("#logName").val();
            if (checkNull(logName)){
                alert("登录用户名是必填项");
                return;
            }

            var password = $("#password").val();
            if (checkNull(password)){
                alert("密码是必填项");
                return;
            }

            var verifyCode = $("#verifyCode").val();
            if (checkNull(verifyCode)){
                alert("请输入验证码");
                return;
            }

            $.ajax({
                url:"${request.contextPath}/user/loginUser",
                type:"post",
                dataType:"json",
                data:$("#userLoginForm").serializeArray(),
                success:function(data){
                    if (data.status == "success"){
                        window.open("${request.contextPath}/main/indexUrl.php", "_self");
                    } else if (data.status == 'error'){
                        alert(data.msg);
                    } else {
                        alert("未知情况");
                    }
                    replaceCode();
                    $("#verifyCode").val("");
                },
                error:function(e){
                    alert("错误！！");
                    replaceCode();
                }
            });
        }


        /**
         * 回车事件 绑定登录事件
         * @param event
         */
        document.onkeydown = function (event) {
            var e = event || window.event;
            if (e && e.keyCode == 13) { //回车键的键值为13
                loginUserFrom();
            }
        };

    </script>

</body>




</html>
